#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

bool Lily_Number(int n)
{
	int a = (n / 10) * (n % 10);
	int b = (n / 100) * (n % 100);
	int c = (n / 1000) * (n % 1000);
	int d = (n / 10000) * (n % 10000);
	if (n == (a + b + c + d))
	{
		return 1;
	}
	else
		return 0;
}

int main()
{
	int n = 0;
	for (int i = 10000; i < 100000; i++)
	{
		int ret = Lily_Number(i);
		if (ret == 1)
		{
			printf("%d ", i);
		}
	}

	return 0;
}